package com.neuedu.yyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.neuedu.yyzx.entity.CarePurchased;
import com.neuedu.yyzx.entity.NurseRecords;
import com.neuedu.yyzx.mapper.CarePurchasedMapper;
import com.neuedu.yyzx.service.ICarePurchasedService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 已购护理服务  服务实现类
 * </p>
 *
 * @author dya
 * @since 2021-04-27
 */
@Service
public class CarePurchasedServiceImpl extends ServiceImpl<CarePurchasedMapper, CarePurchased> implements ICarePurchasedService {
    public boolean updateAll(CarePurchased carePurchased) {
        UpdateWrapper updateWrapper = new UpdateWrapper();

        updateWrapper.set("customer_name", carePurchased.getCustomerName());
        updateWrapper.set("customer_id", carePurchased.getCustomerId());
        updateWrapper.set("nursing_project", carePurchased.getNursingProject());
        updateWrapper.set("last_remain_num", carePurchased.getLastRemainNum());
        updateWrapper.set("buy_num", carePurchased.getBuyNum());
        updateWrapper.set("all_num", carePurchased.getAllNum());
        updateWrapper.set("remain_num", carePurchased.getRemainNum());
        updateWrapper.set("buy_time", carePurchased.getBuyTime());
        updateWrapper.set("state", carePurchased.getState());
        updateWrapper.set("remarks", carePurchased.getRemarks());


        updateWrapper.eq("care_id", carePurchased.getCareId());

        int success = getBaseMapper().update(carePurchased, updateWrapper);

        return success>0;
    }

}
